<template>
	<view>
		<cu-custom :bgColor="'bg-'+ theme.themeColor" :isBack="true">
			<block slot="backText" @tap="leftClick"></block>
			<block slot="content">登录</block>
		</cu-custom>


		<view class="flex padding justify-center" style="margin-top: 30px;">
			<!-- 登录页logo -->
			<!-- <img :src="logoUrl" style="width: 180rpx;height: 180rpx" /> -->
			<img :src="logoUrl" style="width: 180rpx;height: 180rpx" />
		</view>
		<view class="flex padding justify-center">
			<!-- 登录页标题 -->
			<text class="text-black text-bold text-lg">AI优服商城</text>
		</view>
		<view class="margin-xl marzeep">
			<codeLogin v-if="loginType =='1'" :redirectUrl="redirectUrl"></codeLogin>
			<pwdLogin v-if="loginType =='2'" :redirectUrl="redirectUrl"></pwdLogin>
		</view>
		<!--  #ifndef MP-WEIXIN || MP-ALIPAY -->
		<!-- <view class="flex padding justify-center">
			<view>{{loginTile}}</view>
		</view> -->
		<view class=" padding justify-center">
			<view class="text-xl">
				<text class="cuIcon-unlock " :class="'text-'+theme.themeColor" v-if="loginType != '2'" @tap="getLoginType('2')">进行登录
				</text>
			</view>
			<view class="text-xl">
				<text class="cuIcon-unlock" :class="'text-'+theme.themeColor" v-if="loginType != '1'" @tap="getLoginType('1')">进行注册
				</text>
			</view>
		</view>
        <!--  #endif -->
		<!-- <view class="cu-bar foot flex padding justify-center">
			<text class="text-black text-center">AI优服商城 版本所有</text>
		</view> -->
	</view>
</template>
<script>
	import config from 'config/env';
	import codeLogin from './codelogin.vue';
	import pwdLogin from './pwdLogin.vue';
	export default {
		components: {
			codeLogin,
			pwdLogin
		},
		data() {
			return {
				logoUrl: config.logoSrc,
				theme: getApp().globalData.theme,
				form: {},
				loginType: "2", // 1.密码登录 2.验证码登录 
				redirectUrl: '',
				loginTile:'进行登录'
			};
		},
		onLoad(option) {
			this.redirectUrl = option.redirectUrl;
		},
		methods: {
			getLoginType(type) {
				this.loginType = type;
				if(type === '2'){
					this.loginTile = "进行登录"
				}else{
					this.loginTile = "进行注册"
				}
			},
			leftClick() {
				uni.reLaunch({
					url: '/pages/home/index'
				})
			},

		}
	};
</script>
<style lang="scss">
	.text-xl{
		width: 93%;
		margin: 0 auto;
		.cuIcon-unlock {
			border: 1px solid #38ceb1;
			width: 100%;
			display: block;
			height: 33px;
			font-size: 14px;
			text-align: center;
			line-height: 33px;
			border-radius: 5px;
		}
	}
	.text-xxl{
		
	}
	.marzeep{
		margin-bottom: 0;
	}
</style>
